﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace System
{
	/// <summary>
	/// Extensions on the Object class
	/// </summary>
	public static class NullExtensions
	{
		public static bool IsNull(this object object_for_test)
		{
			return null == object_for_test;
		}
		public static bool IsNotNull(this object object_for_test)
		{
			return !object_for_test.IsNull();
		}
		public static T Cast<T>(this object @object)
		{
			if (@object == null) return default(T);
			if (@object.GetType().IsAssignableFrom(typeof(T)))
				return (T)@object;
			return default(T);
		}
	}
}
